// pages/address_lxj/address_lxj.js
Page({
  data: {
    address:"闽江学院第二食堂",
    //标记点
    markers:[{
      id:0,
      name:"闽江学院第二食堂",
      address:"二堂",
      latitude:"26.068197",
      longitude:"119.169672",
      width:40,
      height:40
    }]
  },
  onLoad(options) {
    
  },
  tapMarker_lxj(e){
    let marker = e.currentTarget.dataset.marker
    console.log("点击了",marker);
    
    wx.getLocation({
       type: 'wgs84',
      success (res) {
        wx.openLocation({
      latitude:parseFloat(marker.latitude),
      longitude:parseFloat(marker.longitude),
      name:marker.name,
      address:marker.address,
      scale: 18
    })
      },
      fail(res){
        console.log("失败",res)
        wx.showModal({
          title:"需要授权",
          content:"需要授权位置信息",
          confirmText:"去设置",
          success(res){
            console.log("弹窗点击",res);
            if(res.confirm){
              wx.openSetting()
            }
          },
          cancelColor:'cancelColor'
        })
      }
     })

  },
  copyBtn(e){
    console.log(e);
    wx.setClipboardData({
      data: e.currentTarget.dataset.address,
    })
  }
})